-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
misc fixes #724
misc fixes #724
Conversation
@@ -40,6 +45,7 @@ const addPopup = (e: HTMLElement, id: string, contents: string, mobile?: boolean | |||
const toggle = () => popup.classList.toggle('shown') | |||
popup.addEventListener('click', togglePopup(toggle, e)) | |||
e.addEventListener('click', togglePopup(toggle, e)) | |||
popup.children[0].addEventListener('click', (e) => e.stopPropagation()) | |||
} | |||
|
|||
return popup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mruwnik, ok so there is a problem with multiple popups being added to a reference item for definitions. I think specifically, because the id is generated randomly, there can still exist two popups associated with the same reference whenever the function which creates the random ids is run more than once. And because react tends to just run things randomly...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried fixing this myself but I couldn't figure it out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm. You're right :/ One way round this would be to pass in the id, rather than use a random one. So normal articles would just leave it empty, and chatbot ones would pass in their index in the history.
Otherwise the id would have to be generated based on the contents somehow, which would work for chat responses (as most of the time they will be unique), but not for articles in the chatbot (unless they have some magic token added secretly, which is also ugly). In this case the randomId would just be a hash of the html
argument or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -40,6 +45,7 @@ const addPopup = (e: HTMLElement, id: string, contents: string, mobile?: boolean | |||
const toggle = () => popup.classList.toggle('shown') | |||
popup.addEventListener('click', togglePopup(toggle, e)) | |||
e.addEventListener('click', togglePopup(toggle, e)) | |||
popup.children[0].addEventListener('click', (e) => e.stopPropagation()) | |||
} | |||
|
|||
return popup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm. You're right :/ One way round this would be to pass in the id, rather than use a random one. So normal articles would just leave it empty, and chatbot ones would pass in their index in the history.
Otherwise the id would have to be generated based on the contents somehow, which would work for chat responses (as most of the time they will be unique), but not for articles in the chatbot (unless they have some magic token added secretly, which is also ugly). In this case the randomId would just be a hash of the html
argument or something
No description provided.